long extrint(long s)
{
    long sum = 0;
    long tmp = s;
    int cnt = 0;
    while (tmp > 0)
    {
        sum = sum * 10 + tmp % 10;
        tmp /= 10;
        cnt++;
    }
    s = sum;
    sum = 0;
    if (cnt % 2 == 1)
    {
        for (int i = 1; s > 0; i += 3)
        {
            int tmp1 = s % 10;
            s /= 10;
            if (i % 2 == 1)
                sum = sum * 10 + tmp1;
        }
    }
    else {
        for (int i = 1; s > 0; i += 3)
        {
            int tmp1 = s % 10;
            s /= 10;
            if (i % 2 == 0)
                sum = sum * 10 + tmp1;
        }
    }

    return sum;
}